package com.cskaoyan.gateway.controller.shopping;

import com.mall.commons.result.ResponseData;
import com.mall.commons.result.ResponseUtil;
import com.mall.shopping.IHomeService;
import com.mall.shopping.dto.HomePageResponse;
import com.mall.shopping.dto.NavListResponse;
import com.mall.user.annotation.Anoymous;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 处理主页显示/shopping/homepage 和 导航栏显示/shopping/navigation
 */
@Slf4j
@RestController
@Anoymous
public class HomepageAndNavigationForShopping {
    @Reference(check = false,retries = 0,timeout = 3000)
    IHomeService iHomeServiceImpl;

    @GetMapping("shopping/homepage")
    public ResponseData getHomepage(){
        HomePageResponse homepage = iHomeServiceImpl.homepage();
        return  new ResponseUtil<HomePageResponse>().setData(homepage);
    }

    @GetMapping("shopping/navigation")
    public ResponseData navigation(){
        NavListResponse navigation = iHomeServiceImpl.navigation();
        return new ResponseUtil<NavListResponse>().setData(navigation);
    }
}
